<extend name="Base/common"/>
<block name="head_css">
<link href="__PUBLIC__/Green/css/usercenter.css" rel='stylesheet' type='text/css' />
</block>
<block name="head_script">
    <script type="text/javascript" src="__PUBLIC__/Green/js/usercenter.js"></script>
</block>
<block name="body">
    <div class="width1000">
        <div class="top_tit">
            <a href="{:U('User/index')}">用户中心</a> &gt;&gt; 我的账号 &gt;&gt; 账户安全
        </div>
        <div class="clearfix relative">
            <include file="User/nav" />
            <div class="user_center">
                <div class="user_profit">
                    <div class="profile_tit">
                       账户安全
                    </div>
                    <div class="profile_person">

                        <p class="pro_count_tit">手机号码 &nbsp;&nbsp;&nbsp;{$user.mobile}
                            <a href="{:U('User/changePhone')}" class="f_r profile_psd_btn" >设置修改</a>
                        </p>
                    </div>
                    <div class="profile_person">
                        <p class="pro_count_tit">登陆密码
                            <a href="javascript:void(0);" class="f_r profile_psd_btn hide" id="profile_psd_btn1">设置修改</a>
                            <a href="javascript:void(0);" class="f_r profile_psd_btn" id="profile_psd_submit1">保存</a>
                        </p>
                        <form action="{:U('User/chgPass')}" method="post" class="form-horizontal" id="chgLogPass">
                        	<eq name="user['login_password_changes']" value="0">
                             <label style="color: #b7b7b7;font-size: 13px;font-weight: 100;">为了您的账号安全请设置登录密码</label>
                          <div class="form-group" style="margin-top: 20px">
                            <label class="col-sm-2 control-label">设置登录密码</label>
                            <div class="col-sm-6">
                                <input type="password" name="newpass" class="form-control" id="newpass" placeholder="密码" />
                            </div>
                          </div>
                          <div class="form-group">
                            <label for="verfyCode" class="col-sm-2 control-label">密码确认</label>
                            <div class="col-sm-6">
                                <input type="password" name="repass" class="form-control" id="repass" placeholder="密码确认" />
                            </div>
                          </div>
                          <else/>
                          <div class="form-group">
                            <label class="col-sm-2 control-label">原始密码</label>
                            <div class="col-sm-6">
                                <input type="password" name="oldpass" class="form-control" id="oldpass" placeholder="原始的登录密码" />
                            </div>
                            <div class="col-sm-4">
                                <a href="{:U('User/setPass')}" class="profile_psd_btn">忘记密码</a>
                            </div>
                          </div>
                          <div class="form-group">
                            <label for="verfyCode" class="col-sm-2 control-label">新密码</label>
                            <div class="col-sm-6">
                                <input type="password" name="newpass" class="form-control" id="newpass" placeholder="新的登录密码" />
                            </div>
                          </div>
                          <div class="form-group">
                            <label for="verfyCode" class="col-sm-2 control-label">密码确认</label>
                            <div class="col-sm-6">
                                <input type="password" name="repass" class="form-control" id="repass" placeholder="密码确认" />
                            </div>
                          </div>
                          </eq>
                        </form>
                    </div>
                    <div class="profile_person" style="border-bottom:0px">
                        <p class="pro_count_tit">支付密码
                            <a href="javascript:void(0);" class="f_r profile_psd_btn hide" id="profile_psd_btn2">设置修改</a>
                            <a href="javascript:void(0);" class="f_r profile_psd_btn" id="profile_psd_submit2">保存</a>
                        </p>
                        
                        <form action="{:U('User/chgCashPass')}" method="post" class="form-horizontal" id="chgCashPass">
                         <eq name="user['cash_passwd']" value=""> 
                         <label style="color: #b7b7b7;font-size: 13px;font-weight: 100;">当您使用收益余额兑换商品时将会验证支付密码</label>
                          <div class="form-group" style="margin-top: 20px">
                            <label class="col-sm-2 control-label">设置支付密码</label>
                            	
                            <div class="col-sm-6" >
                                <input type="password" name="newpass" class="form-control" id="newpass" placeholder="输入支付密码" />
                            </div>
                          </div>
                          <div class="form-group">
                            <label for="verfyCode" class="col-sm-2 control-label">密码确认</label>
                            <div class="col-sm-6">
                                <input type="password" name="repass" class="form-control" id="repass" placeholder="密码确认" />
                            </div>
                          </div>
                          <else/>
                            <div class="form-group">
                            <label class="col-sm-2 control-label">原始密码</label>
                            <div class="col-sm-6">
                                <input type="password" name="oldcpass" class="form-control" id="oldcpass" placeholder="原始的支付密码" />
                            </div>
                            <div class="col-sm-4">
                                <a href="{:U('User/setPass',array('type'=>'cash'))}" class="profile_psd_btn">忘记密码</a>
                            </div>
                          </div>
                          <div class="form-group">
                            <label for="verfyCode" class="col-sm-2 control-label">新密码</label>
                            <div class="col-sm-6">
                                <input type="password" name="newcpass" class="form-control" id="newcpass" placeholder="新的登录密码" />
                            </div>
                          </div>
                          <div class="form-group">
                            <label for="verfyCode" class="col-sm-2 control-label">密码确认</label>
                            <div class="col-sm-6">
                                <input type="password" name="recpass" class="form-control" id="recpass" placeholder="密码确认" />
                            </div>
                          </div>
                           </eq>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</block>    
<block name="script">
<script type="text/javascript" src="__PUBLIC__/Green/js/insurance.js"></script>
<script type="text/javascript">
    highlight_nav("{:U('User/secure')}");
    highlight_nav("javascript:void(0);");
    
    $("a[id^=profile_psd_btn]").on("click", function() {
        $(this).hide().next().show();
        $(this).parent().next().show();
    });
    $("a[id^=profile_psd_submit]").on("click", function() {
        $(this).parent().next().submit();
    });
    
    $('#chgLogPass').validate({
        rules:{
            oldpass:{
                required:true
            },
            newpass:{
                required:true
            },
            repass:{
                equalTo:'#newpass'
            }
        },
        messages:{
            oldpass:{
                required:'请填写原始的登录密码'
            },
            newpass:{
                required:'请填写新的登录密码'
            },
            repass:{
                equalTo:'两次输入的密码不同'
            }
        },
        submitHandler:function(form){
            var self = $(form);
            $.post(self.attr("action"), self.serialize(), function(data){
                if(data.status){
                    alert(data.info);
                    $(form)[0].reset();
                } else {
                    alert(data.info);
                }
            }, "json");
        }
    });
    $('#chgCashPass').validate({
        rules:{
            oldcpass:{
                required:true
            },
            newcpass:{
                required:true
            },
            recpass:{
                equalTo:'#newcpass'
            }
        },
        messages:{
            oldcpass:{
                required:'请填写原始的支付密码'
            },
            newcpass:{
                required:'请填写新的支付密码'
            },
            recpass:{
                equalTo:'两次输入的密码不同'
            }
        },
        submitHandler:function(form){
            var self = $(form);
            $.post(self.attr("action"), self.serialize(), function(data){
                if(data.status){
                    alert(data.info);
                    $(form)[0].reset();
                } else {
                    alert(data.info);
                }
            }, "json");
        }
    });
</script>
</block>
